(function($) {       
$.imageFileVisible = function(options) {     
     // 默认选项
var defaults = {    
//包裹图片的元素
wrapSelector: null,    
//<input type=file />元素
  fileSelector:  null ,
  width : '100%',
  height: 'auto',
  errorMessage: "很抱歉，无法识别该文件."
 };    
 // Extend our default options with those provided.    
 var opts = $.extend(defaults, options);     
 $(opts.fileSelector).on("change",function(){
	var file = this.files[0];
	var imageType = /image.*/;
	if (file.type.match(imageType)) {
		var reader = new FileReader(); 
		reader.onload = function(){
			var img = new Image();
			img.src = reader.result;
			var cup=document.getElementById('photofile');
			console.log(cup.src);
			console.log(img.src);
			cup.src=img.src;
			$(img).width( opts.width);
			$(img).height( opts.height);
			$( opts.wrapSelector ).append(img);
		};
		reader.readAsDataURL(file);
	}else{
		//alert(opts.errorMessage);
		showtip(opts.errorMessage);
	}
});
};     
})(jQuery); 
